<?php
/**
 * Created by PhpStorm.
 * User: sunfan
 * Date: 2017/8/21
 * Time: 17:17
 */

namespace User\Controller;


use Common\Controller\AdminbaseController;

class AdvertiseController extends AdminbaseController
{

    public function index(){
        $count = D("Ad")->count();
        $page = $this->page($count,12);
        $list = D("Ad")->limit($page->firstRow.','.$page->listRows)->select();
        $this->assign('page',$page->show());
        $this->assign('list',$list);
        $this->display();
    }

    public function add(){
        if(IS_POST){
            if(D("Ad")->add($_POST)){
                $this->success("添加成功",U('Advertise/index'));
                exit();
            }
            $this->error("添加失败");
        }
        $this->display();
    }
}